package com.pkx.cloud.fse7.dms.openrecord.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pkx.cloud.fse7.dms.openrecord.entity.OpenRecord;
import com.pkx.cloud.fse7.dms.openrecord.repo.OpenRecordMapper;
import com.pkx.cloud.fse7.dms.openrecord.service.OpenRecordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 服务实现类
 *
 * @author chenwg
 * @since 2020-10-14
 */
@Service
public class OpenRecordServiceImpl extends ServiceImpl<OpenRecordMapper, OpenRecord> implements OpenRecordService {

    @Resource
    private OpenRecordMapper openRecordMapper;

    /**
     * 分页列表
     *
     * @param openRecord
     * @return
     */
    @Override
    public Page<OpenRecord> pageList(Page page, OpenRecord openRecord) {
        return openRecordMapper.pageList(page, openRecord);
    }


    /**
     * 列表查询
     *
     * @param openRecord
     * @return
     */
    @Override
    public List<OpenRecord> listByEntity(OpenRecord openRecord) {
        LambdaQueryWrapper<OpenRecord> lambdaQueryWrapper = Wrappers.lambdaQuery(OpenRecord.class);
        return list(lambdaQueryWrapper);
    }

    /**
     * 详情
     *
     * @param id
     * @return
     */
    @Override
    public OpenRecord selectById(Long id) {
        String byRecordId = baseMapper.getByRecordId(id);
        return null;
    }

    /**
     * 保存
     *
     * @param openRecord
     * @return
     */
    @Override
    public Boolean saveOpenRecord(OpenRecord openRecord) {
        return save(openRecord);
    }

    /**
     * 修改
     *
     * @param openRecord
     * @return
     */
    @Override
    public Boolean modify(OpenRecord openRecord) {
        return updateById(openRecord);
    }

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @Override
    public Boolean deleteById(Long id) {
        return removeById(id);
    }

    @Override
    public Map getByRecordAId(Long id) {
        return baseMapper.getByRecordAId(id);
    }

    @Override
    public String getByRecordId(Long id) {
        return baseMapper.getByRecordId(id);
    }
}
